﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FCMS.Collections.Extensions
{
    public static class DictionaryExtensions
    {
        public static ReadOnlyDictionary<TKey, TElement> ToReadOnlyDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
        {
            return new ReadOnlyDictionary<TKey, TElement>(source.ToDictionary(keySelector, elementSelector));
        }
    }
}
